package com.young.shop.controller;

import com.young.shop.dao.impl.OrdersListDaoImpl;
import com.young.shop.pojo.entity.OrderList;
import com.young.shop.pojo.entity.OrdersDetails;
import com.young.shop.pojo.entity.OrdersStatus;
import com.young.shop.service.impl.OrderServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

@WebServlet("/details")
public class OrdersViewDetails extends BaseController {
    OrderServiceImpl orderService = new OrderServiceImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp){
        OrdersDetails ordersDetails = convertParamsToEntity(req, OrdersDetails.class);
        try {
            List<OrdersDetails> ordersDetails1 = orderService.detailsById(ordersDetails.getId());
            writerSuccessResult(ordersDetails1,resp);
        }catch (Exception e){
            writerErrorResult(e.getMessage(),resp);
        }
    }
}
